home *** CD-ROM | disk | FTP | other *** search
- From: theOnlyHeretic@msn.com (John West)
- Subject: RE: Help, writeing initializing graphics
- Date: 29 Mar 96 06:35:12 -0800
- References: <4j4qpb$jra@tribune.usask.ca>
- Message-ID: <00001a80+00008b59@msn.com>
- Path: news.msn.com!msn.com
- Newsgroups: comp.lang.c
- Organization: The Microsoft Network (msn.com)
-
- Hi Alan, Yeah I kind a know what you mean. Kay, you said you have an
- IBM so I'm gonna assume your probably working from a DOS or DOS
- compatable environment; although, BIOS should transend that.
- In C to cause an interupt you need to call _int86 or one of the other
- flavors of this function. (alternatively use the inline assembler the
- probably is inherent in your compiler) Along with int86 you need to
- use Union REGS Which is a special struction designed to 'mimick' the
- registers of the X86 types of CPU's.
- The BIOS Functions that deal with Video are INT 10h functions. I'm
- not even Going to list all of the 10h toys 'cause theres alot of
- them. The one you asked for is Function 00h (Set Video Mode). You
- didn't mention what mode you want to put it in so I'll guess and say
- your a game programmer and want a nice friendly 320X200 256 color
- mode that every VGA video card (and it's parent, so I'm told) can
- support.
- So we've done alittle back ground, Ready for some code?
-
-
- #Include <DOS.H>
- #define VGA 0x13
- Void Set_Mode () // Sets the current video mode to 320X200 X256
- {
- Union REGS InRegs, OutRegs;
- InRegs.h.ah=VGA; //Load the Function into AH Register
- _int86(0x10,&InRegs, &OutRegs);
- return;
- }
-
- Blamo! Your in 320X200 256 color Graphics. Address 0xA0000 Is the
- Starting point of Video memory with this mode and from there the fun
- starts.
- Having said all of this I have to admit it's alot. What you really
- need is a Good Assembly Book (I reccomend "The Revolutionary Guide To
- Assembly", WROX books, By Vitaly Maljugin and others. It reads well
- has plenty of source code for examples, and tells you how to do
- everything in DOS, BIOS, and where possible at the HARDWARE level.)
- Additionally, take a cruise through your help files that come with
- your compiler. Often times looking over what functions go in what
- header files can give you some great starting points. ie, what's in
- graphics.h? Also take a closer look at the Contents of union regs.
- Let me know if this helped out some. My email is
- theOnlyHeretic@msn.com.Goodluck!
-
-